package buzhidao;
import java.util.Scanner;

abstract class Employee {
    public abstract int getSalary();
}

class Manager extends Employee {
    private int fixedSalary;

    public Manager(int fixedSalary) {
        this.fixedSalary = fixedSalary;
    }

    @Override
    public int getSalary() {
        return fixedSalary;
    }
}

class Salesman extends Employee {
    private int baseSalary;
    private int salesAmount;

    public Salesman(int baseSalary, int salesAmount) {
        this.baseSalary = baseSalary;
        this.salesAmount = salesAmount;
    }

    @Override
    public int getSalary() {
        return baseSalary + (int) (salesAmount * 0.3);
    }
}

class Worker extends Employee {
    private int workDays;
    private int dailyWage;

    public Worker(int workDays, int dailyWage) {
        this.workDays = workDays;
        this.dailyWage = dailyWage;
    }

    @Override
    public int getSalary() {
        return workDays * dailyWage;
    }
}

public class EmployeeSalarySystem {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int managerSalary = scanner.nextInt();

      
        int salesmanBaseSalary = scanner.nextInt();
        int salesmanSalesAmount = scanner.nextInt();

       
        int workerDays = scanner.nextInt();
        int workerDailyWage = scanner.nextInt();

      
        Employee manager = new Manager(managerSalary);
        Employee salesman = new Salesman(salesmanBaseSalary, salesmanSalesAmount);
        Employee worker = new Worker(workerDays, workerDailyWage);

      
        System.out.println(manager.getSalary());
        System.out.println(salesman.getSalary());
        System.out.println(worker.getSalary());

        scanner.close();
    }
}    